package vip.sweet.biz.modular.user.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.sweet.biz.modular.user.params.BizUserAddressAddParams;
import vip.sweet.biz.modular.user.service.BizUserAddressesService;
import vip.sweet.common.enums.ResponseEnum;
import vip.sweet.common.response.CommonResponse;

/**
 * @author ASUS
 * @Date 2025/10/5 12:03
 * @Descripition
 */
@RestController
@RequestMapping("/biz/userAddresses")
@Tag(name = "用户地址管理控制器")
public class BizUserAddressesController {
    @Resource
    private BizUserAddressesService bizUserAddressesService;
    @PostMapping("/add")
    @Operation(summary = "添加用户地址接口")
    public CommonResponse add(@RequestBody @Validated BizUserAddressAddParams bizUserAddressAddParams) {
        return bizUserAddressesService.add(bizUserAddressAddParams)? CommonResponse.success("添加成功") : CommonResponse.error(ResponseEnum.ERROR);
    }
    @GetMapping("/getCustomerAddressById")
    @Operation(summary = "获取用户地址接口")
    public CommonResponse getCustomerAddressById(@RequestParam String userId) {
        return CommonResponse.success(bizUserAddressesService.getCustomerAddressById(userId));
    }
}
